package com.caishi.lkx.order.service;

import com.caishi.lkx.common.ienum.DeviceType;
import com.zzw.common.entity.BaseService;
import com.caishi.lkx.order.ienum.type.PaymentType;
import com.caishi.lkx.order.model.OrderModel;
import com.caishi.lkx.order.model.PaymentModel;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
 * @author by keray
 * date:2021/5/14 2:36 下午
 */
public interface IPaymentService extends BaseService<PaymentModel, Long> {
    /**
     * <p>
     * <h3>作者 keray</h3>
     * <h3>时间： 2019/10/12 16:49</h3>
     * 常见订单支付单
     * </p>
     *
     * @param orderModel
     * @param paymentType
     * @return <p> {@link PaymentModel} </p>
     * @throws
     */
    PaymentModel createPayment(OrderModel orderModel, PaymentType paymentType);

    PaymentModel getPayModel(String orderId);


    /**
     * <p>
     * <h3>作者 keray</h3>
     * <h3>时间： 2019/9/9 14:00</h3>
     * 获取支付签名信息
     * </p>
     *
     * @param paymentType
     * @param deviceType  支付设备
     * @param val         附加参数
     * @return <p> {@link Map < String, Object>} </p>
     */
    @Transactional(rollbackFor = Exception.class)
    Map<String, Object> getPaySign(String currentUser, PaymentType paymentType, String orderId, DeviceType deviceType, Object val, Map<String, Object> otherParam);

    /**
     * <p>
     * <h3>作者 keray</h3>
     * <h3>时间： 2021/7/15 11:13 上午</h3>
     * 校验订单是否支付完成
     * </p>
     *
     * @param orderId
     * @return <p> {@link boolean} </p>
     * @throws
     */
    boolean checkOrderPay(String orderId);

    /**
     * <p>
     * <h3>作者 keray</h3>
     * <h3>时间： 2019/9/5 13:55</h3>
     * 订单支付完成，不允许前端接口调用，只适用于异步通知接口调用
     * </p>
     *
     * @param orderId
     * @return <p> {@link } </p>
     * @throws
     */
    void paySuccess(String orderId, Object image,String recommend);

    /**
     * <p>
     * <h3>作者 keray</h3>
     * <h3>时间： 2019/9/10 14:12</h3>
     * 订单退款 退款金额
     * </p>
     *
     * @param orderModel
     * @return <p> {@link } </p>
     * @throws
     */
    @Transactional(rollbackFor = Exception.class)
    void payRefund(OrderModel orderModel, Long refundAmount);
}
